import request from "@/utils/request";

// 收货地址列表
export const getAddressList = () => {
  return request.get("/address/list");
};

// 订单结算
export const getOrderSettlement = (mode, obj) => {
  return request.get("/checkout/order", {
    params: {
      mode, // mode cart => 加入购物车 buyNow => 立即购买
      delivery: 10, //配送方式 10 => 快递配送 20 => 自取
      shopId: 0,
      couponId: 0,
      ...obj,
    },
  });
};

// 提交订单
export const submitOrder = (mode, obj) => {
  return request.post("/checkout/submit", {
    mode,
    delivery: 10, //配送方式 10 => 快递配送 20 => 自取
    couponId: 0,
    isUsePoints: 0,
    payType: 10, // 10 => 余额支付
    ...obj,
  });
};
